package com.freecloud.javabasics.design.single;

import com.freecloud.javabasics.design.entity.car.BMW;
import com.freecloud.javabasics.design.entity.car.Car;

/**
 * 单例：内部类形式
 * @Author: maomao
 * @Date: 2020-02-29 21:36
 */
public class InnerClass {


    public static Car getInstance(){
        return InnerClassHandler.car;
    }

    private static class InnerClassHandler{
        private static Car car = new BMW();

        static {
            System.out.println(" InnerClassHandler static!");
        }
    }
}
